<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <style type="text/css">
        .tdcontent{
            overflow:hidden;
            white-space:nowrap;
            text-overflow:ellipsis;
        }
    </style>
</head>
<body>
    <c:if test="${count <= 0}">
        <script>
            alert('当前暂无数据，请先去添加几个吧');
            window.location.href = 'add';
        </script>
    </c:if>
    <jsp:include page="../frame.jsp"></jsp:include>
    <link href="/yibinu_certificate/static/assets/bootstrap-table/css/bootstrap-table.css" rel="stylesheet" />
    <script src="/yibinu_certificate/static/assets/bootstrap-table/js/bootstrap-table.js"></script>
    <script src="/yibinu_certificate/static/assets/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <div id="page-wrapper" >
        <div class="header">
            <h1 class="page-header">
                学生获奖信息管理
            </h1>
            <ol class="breadcrumb">
                <li><a href="/yibinu_certificate/index">首页</a></li>
                <li><a href="">学生获奖信息管理</a></li>
                <li class="active">学生获奖信息列表</li>
            </ol>

        </div>

        <div id="page-inner">

            <div class="row">
                <div class="col-md-12">
                    <div class="card">
                        <div class="card-action">
                            学生获奖信息表
                        </div>
                        <div class="card-content">
                            <div>${msg}</div>
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="table-teacher">
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /. PAGE INNER  -->
    </div>
    <!-- /. PAGE WRAPPER  -->
</div>
<!-- /. WRAPPER  -->
</body>
<script type="text/javascript">

    var $table = $('#table-teacher');
    $().ready(function(){
        $table.bootstrapTable({
            url : '/yibinu_certificate/studentPrize/getAllStudentPrizeInfo',
            method : 'POST',
            search : true,
            searchAlign : 'left',
            showRefresh : true,
            showHeader : true,
            showToggle : true,
            showColumns : true,
            pagination: true,
            pageSize: 5,
            pageList: [5,10,25,50,100],
            columns : [ {
                field : 'stuName',
                title : '学生姓名',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'stuClass',
                title : '学生班级',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'stuMajor',
                title : '学生专业',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'stuSchool',
                title : '二级学院',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'certificateType',
                title : '证书类型',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'leadTeacher',
                title : '指导教师',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'prizeTime',
                title : '获奖时间',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'prizeName',
                title : '奖项名称',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'prizeGrade',
                title : '获奖等级',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'prizeLevel',
                title : '获奖级别',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'reportTime',
                title : '上传时间',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            }, {
                field : 'auditingStatus',
                title : '审核状态',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'auditingTime',
                title : '审核时间',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                field : 'auditingPeople',
                title : '审核人',
                align: 'left',
                valign: 'middle',
                class : 'tdcontent',
                sortable : true
            },{
                    field : 'actions',
                    title : '操作',
                    formatter : operateFormatter,
            }],
            silent : true,
            formatNoMatches : function () {
                return '没有符合条件的记录';
            }
        });

        // 判断是手机访问
        if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
            // 修改样式
            $('.search').css({"width":"100%"});
            $('.columns').css({"padding-right":"20%"});
            $('.columns').css({"padding-left":"20%"});
        }
    });

    <c:choose>
        <c:when test="${not empty user && user.role != 'student'}">
            /**
             * 最后一列加入操作
             * @author 子墨
             * @date 2018/8/25 17:55
             * @params
             * @return
             */
            function operateFormatter(value, row, index) {
                return [
                    '<div class="hidden-sm hidden-xs action-buttons">\n' +
                    '                                                        <a href="export" title="一键导出Excel">\n' +
                    '                                                            <i class="fa fa-file-word-o bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '                                                        <a href="timeline?id='+row.id+'" title="以时间线方式查看获奖记录">\n' +
                    '                                                            <i class="fa fa-clock-o bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '\n' +
                    '                                                        <a href="add" title="添加">\n' +
                    '                                                            <i class="fa fa-plus bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '                                                        <a href="audite?id='+row.id+'" title="审核/驳回">\n' +
                    '                                                            <i class="fa fa-check bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '                                                        <a href="update?id='+row.id+'" title="编辑">\n' +
                    '                                                            <i class="fa fa-pencil bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '                                                        <a href="delete?id='+row.id+'" title="删除">\n' +
                    '                                                            <i class="fa fa-trash-o bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '                                                    </div>\n' +
                    '\n' +
                    '                                                    <div class="hidden-md hidden-lg">\n' +
                    '                                                        <div class="inline pos-rel">\n' +
                    '                                                            <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">\n' +
                    '                                                                <i class="fa fa-caret-down icon-only bigger-120"></i>\n' +
                    '                                                            </button>\n' +
                    '\n' +
                    '                                                            <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="export" class="tooltip-info" data-rel="tooltip" title="导出">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-file-word-o bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="timeline?id='+row.id+'" class="tooltip-success" data-rel="tooltip" title="审核/驳回">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-clock-o bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="add" class="tooltip-info" data-rel="tooltip" title="新增">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-plus bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="audite?id='+row.id+'" class="tooltip-success" data-rel="tooltip" title="审核/驳回">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-check bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="update?id='+row.id+'" class="tooltip-success" data-rel="tooltip" title="编辑">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-pencil-square-o bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="delete?id='+row.id+'" class="tooltip-error" data-rel="tooltip" title="删除">\n' +
                    '                                                                    <span>\n' +
                    '                                                                        <i class="fa fa-trash-o bigger-120"></i>\n' +
                    '                                                                    </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '                                                            </ul>\n' +
                    '                                                        </div>\n' +
                    '                                                    </div>'
                ].join('');
            }
        </c:when>
        <c:otherwise>
            /**
             * 最后一列加入操作
             * @author 子墨
             * @date 2018/8/25 17:55
             * @params
             * @return
             */
            function operateFormatter(value, row, index) {
                return [
                    '<div class="hidden-sm hidden-xs action-buttons">\n' +
                    '                                                        <a href="export" title="一键导出Excel">\n' +
                    '                                                            <i class="fa fa-file-word-o bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '                                                        <a href="timeline?id='+row.id+'" title="以时间线浏览获奖信息">\n' +
                    '                                                            <i class="fa fa-clock-o bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '                                                        <a href="add" title="添加">\n' +
                    '                                                            <i class="fa fa-plus bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '                                                        <a href="update?id='+row.id+'" title="编辑">\n' +
                    '                                                            <i class="fa fa-pencil bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '\n' +
                    '                                                        <a href="delete?id='+row.id+'" title="删除">\n' +
                    '                                                            <i class="fa fa-trash-o bigger-130"></i>\n' +
                    '                                                        </a>\n' +
                    '                                                    </div>\n' +
                    '\n' +
                    '                                                    <div class="hidden-md hidden-lg">\n' +
                    '                                                        <div class="inline pos-rel">\n' +
                    '                                                            <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">\n' +
                    '                                                                <i class="fa fa-caret-down icon-only bigger-120"></i>\n' +
                    '                                                            </button>\n' +
                    '\n' +
                    '                                                            <ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="export" class="tooltip-info" data-rel="tooltip" title="导出">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-file-word-o bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="timeline?id='+row.id+'" class="tooltip-success" data-rel="tooltip" title="时间线">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-clock-o bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="add" class="tooltip-info" data-rel="tooltip" title="新增">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-plus bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="update?id='+row.id+'" class="tooltip-success" data-rel="tooltip" title="编辑">\n' +
                    '                                                                        <span>\n' +
                    '                                                                            <i class="fa fa-pencil-square-o bigger-120"></i>\n' +
                    '                                                                        </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '\n' +
                    '                                                                <li>\n' +
                    '                                                                    <a href="delete?id='+row.id+'" class="tooltip-error" data-rel="tooltip" title="删除">\n' +
                    '                                                                    <span>\n' +
                    '                                                                        <i class="fa fa-trash-o bigger-120"></i>\n' +
                    '                                                                    </span>\n' +
                    '                                                                    </a>\n' +
                    '                                                                </li>\n' +
                    '                                                            </ul>\n' +
                    '                                                        </div>\n' +
                    '                                                    </div>'
                ].join('');
            }
        </c:otherwise>
    </c:choose>
</script>

</html>